package com.aspose.cells;

class zkk {
   static Color a(Color var0, double var1) {
      int[] var3 = new int[]{var0.getR() & 255, var0.getG() & 255, var0.getB() & 255};

      for(int var4 = 0; var4 < 3; ++var4) {
         double var5 = a(var3[var4]);
         double var7 = var5 * (1.0D + (1.0D - var1));
         if (var1 > 0.0D) {
            var7 = var5 * (1.0D - (1.0D - var1)) + (1.0D - var1);
         }

         var3[var4] = a(var7);
      }

      return Color.fromArgb(var3[0], var3[1], var3[2]);
   }

   static Color b(Color var0, double var1) {
      int[] var3 = new int[]{var0.getR() & 255, var0.getG() & 255, var0.getB() & 255};

      for(int var4 = 0; var4 < 3; ++var4) {
         double var5 = a(var3[var4]);
         double var7 = var5 * var1;
         if (var7 < 0.0D) {
            var7 = 0.0D;
         } else if (var7 > 1.0D) {
            var7 = 1.0D;
         }

         var3[var4] = a(var7);
      }

      return Color.fromArgb(var3[0], var3[1], var3[2]);
   }

   static Color c(Color var0, double var1) {
      if (var1 == 0.0D) {
         return var0;
      } else {
         zads var3 = f(var0);
         if (var1 < 0.0D) {
            var3.c(var3.c() * (1.0D + var1));
         } else if (var1 > 0.0D) {
            var3.c(var3.c() * (1.0D - var1) + var1);
         }

         return a(var3);
      }
   }

   static Color d(Color var0, double var1) {
      int var3 = (int)com.aspose.cells.b.a.zq.a(255.0D * (1.0D - var1), 0, 1);
      return Color.a(var3, var0);
   }

   static Color e(Color var0, double var1) {
      int var3 = (int)com.aspose.cells.b.a.zq.a(255.0D * (1.0D - (1.0D - (double)(var0.getA() & 255) / 255.0D) * var1), 0, 1);
      return Color.a(var3, var0);
   }

   static Color f(Color var0, double var1) {
      int var3 = (int)com.aspose.cells.b.a.zq.a(255.0D * (1.0D - (1.0D - (double)(var0.getA() & 255) / 255.0D) - var1), 0, 1);
      return Color.a(var3, var0);
   }

   static Color g(Color var0, double var1) {
      double var3 = a(255);
      var3 *= var1;
      int var5 = a(var3);
      return Color.fromArgb(var5, var0.getG() & 255, var0.getB() & 255);
   }

   static Color h(Color var0, double var1) {
      double var3 = a(var0.getR() & 255);
      var3 *= var1;
      int var5 = a(var3);
      return Color.fromArgb(var5, var0.getG() & 255, var0.getB() & 255);
   }

   static Color i(Color var0, double var1) {
      double var3 = a(var0.getR() & 255);
      var3 += var1;
      int var5 = a(var3);
      return Color.fromArgb(var5, var0.getG() & 255, var0.getB() & 255);
   }

   static Color j(Color var0, double var1) {
      double var3 = a(255);
      var3 *= var1;
      int var5 = a(var3);
      return Color.fromArgb(var0.getR() & 255, var5, var0.getB() & 255);
   }

   static Color k(Color var0, double var1) {
      double var3 = a(var0.getG() & 255);
      var3 *= var1;
      int var5 = a(var3);
      return Color.fromArgb(var0.getR() & 255, var5, var0.getB() & 255);
   }

   static Color l(Color var0, double var1) {
      double var3 = a(var0.getG() & 255);
      var3 += var1;
      int var5 = a(var3);
      return Color.fromArgb(var0.getR() & 255, var5, var0.getB() & 255);
   }

   static Color m(Color var0, double var1) {
      double var3 = a(255);
      var3 *= var1;
      int var5 = a(var3);
      return Color.fromArgb(var0.getR() & 255, var0.getG() & 255, var5);
   }

   static Color n(Color var0, double var1) {
      double var3 = a(var0.getB() & 255);
      var3 *= var1;
      int var5 = a(var3);
      return Color.fromArgb(var0.getR() & 255, var0.getG() & 255, var5);
   }

   static Color o(Color var0, double var1) {
      double var3 = a(var0.getB() & 255);
      var3 += var1;
      int var5 = a(var3);
      return Color.fromArgb(var0.getR() & 255, var0.getG() & 255, var5);
   }

   static Color a(Color var0) {
      zads var1 = f(var0);
      if (var1.a() < 180.0D) {
         var1.a(var1.a() + 180.0D);
      } else {
         var1.a(var1.a() - 180.0D);
      }

      return a(var1);
   }

   static Color b(Color var0) {
      int[] var1 = new int[]{var0.getR() & 255, var0.getG() & 255, var0.getB() & 255};

      for(int var2 = 0; var2 < 3; ++var2) {
         double var3 = 1.0D - a(var1[var2]);
         var1[var2] = a(var3);
      }

      return Color.fromArgb(var1[0], var1[1], var1[2]);
   }

   static double a(int var0) {
      double var1 = (double)var0 / 255.0D;
      double var3 = 0.0D;
      if (var1 < 0.0D) {
         var3 = 0.0D;
      } else if (var1 <= 0.04045D) {
         var3 = var1 / 12.92D;
      } else if (var1 <= 1.0D) {
         var3 = Math.pow((var1 + 0.055D) / 1.055D, 2.4D);
      } else {
         var3 = 1.0D;
      }

      return var3;
   }

   static int a(double var0) {
      double var2 = 0.0D;
      if (var0 < 0.0D) {
         var2 = 0.0D;
      } else if (var0 <= 0.0031308D) {
         var2 = var0 * 12.92D;
      } else if (var0 < 1.0D) {
         var2 = 1.055D * Math.pow(var0, 0.4166666666666667D) - 0.055D;
      } else {
         var2 = 1.0D;
      }

      return (int)com.aspose.cells.b.a.zq.a(var2 * 255.0D, 0, 1);
   }

   static Color p(Color var0, double var1) {
      zads var3 = f(var0);
      var3.a(var1);
      return a(var3);
   }

   static Color q(Color var0, double var1) {
      zads var3 = f(var0);
      var3.a(var3.a() * var1);
      return a(var3);
   }

   static Color r(Color var0, double var1) {
      zads var3 = f(var0);
      var3.a(var3.a() + var1);
      return a(var3);
   }

   static Color s(Color var0, double var1) {
      zads var3 = f(var0);
      var3.b(var1);
      return a(var3);
   }

   static Color t(Color var0, double var1) {
      zads var3 = f(var0);
      var3.b(var3.b() * var1);
      return a(var3);
   }

   static Color u(Color var0, double var1) {
      zads var3 = f(var0);
      var3.b(var3.b() + var1);
      return a(var3);
   }

   static Color v(Color var0, double var1) {
      zads var3 = f(var0);
      var3.c(var1);
      return a(var3);
   }

   static Color w(Color var0, double var1) {
      zads var3 = f(var0);
      var3.c(var3.c() * var1);
      return a(var3);
   }

   static Color x(Color var0, double var1) {
      zads var3 = f(var0);
      var3.c(var3.c() + var1);
      return a(var3);
   }

   static Color c(Color var0) {
      int[] var1 = new int[]{var0.getR() & 255, var0.getG() & 255, var0.getB() & 255};

      for(int var2 = 0; var2 < 3; ++var2) {
         var1[var2] = (int)com.aspose.cells.b.a.zq.a(Math.min(255.0D, 255.0D * Math.pow((double)var1[var2] / 255.0D, 0.45454545454545453D) + 0.5D), 0, 1);
      }

      return Color.fromArgb(var1[0], var1[1], var1[2]);
   }

   static Color d(Color var0) {
      int[] var1 = new int[]{var0.getR() & 255, var0.getG() & 255, var0.getB() & 255};

      for(int var2 = 0; var2 < 3; ++var2) {
         var1[var2] = (int)com.aspose.cells.b.a.zq.a(255.0D * Math.pow((double)var1[var2] / 255.0D, 2.2D), 0, 1);
      }

      return Color.fromArgb(var1[0], var1[1], var1[2]);
   }

   static Color e(Color var0) {
      int var1 = (int)com.aspose.cells.b.a.zq.a((double)(var0.getR() & 255) * 0.2126D + (double)(var0.getG() & 255) * 0.7152D + (double)(var0.getB() & 255) * 0.0722D, 0, 1);
      return Color.fromArgb(var1, var1, var1);
   }

   static zads f(Color var0) {
      double var1 = 0.0D;
      double var3 = 0.0D;
      double var5 = 0.0D;
      double var7 = (double)(var0.getR() & 255) / 255.0D;
      double var9 = (double)(var0.getG() & 255) / 255.0D;
      double var11 = (double)(var0.getB() & 255) / 255.0D;
      double var13 = Math.max(var7, Math.max(var9, var11));
      double var15 = Math.min(var7, Math.min(var9, var11));
      if (var13 == var15) {
         var1 = 0.0D;
      } else if (var13 == var7 && var9 >= var11) {
         var1 = 60.0D * (var9 - var11) / (var13 - var15);
      } else if (var13 == var7 && var9 < var11) {
         var1 = 60.0D * (var9 - var11) / (var13 - var15) + 360.0D;
      } else if (var13 == var9) {
         var1 = 60.0D * (var11 - var7) / (var13 - var15) + 120.0D;
      } else if (var13 == var11) {
         var1 = 60.0D * (var7 - var9) / (var13 - var15) + 240.0D;
      }

      var5 = (var13 + var15) / 2.0D;
      if (var5 != 0.0D && var13 != var15) {
         if (0.0D < var5 && var5 <= 0.5D) {
            var3 = (var13 - var15) / (var13 + var15);
         } else if (var5 > 0.5D) {
            var3 = (var13 - var15) / (2.0D - (var13 + var15));
         }
      } else {
         var3 = 0.0D;
      }

      return new zads(var1, var3, var5);
   }

   static Color a(zads var0) {
      if (var0.b() == 0.0D) {
         int var9 = (int)com.aspose.cells.b.a.zq.a(var0.c() * 255.0D, 0, 1);
         return Color.fromArgb(var9, var9, var9);
      } else {
         double var1 = var0.c() < 0.5D ? var0.c() * (1.0D + var0.b()) : var0.c() + var0.b() - var0.c() * var0.b();
         double var3 = 2.0D * var0.c() - var1;
         double var5 = var0.a() / 360.0D;
         double[] var7 = new double[]{var5 + 0.3333333333333333D, var5, var5 - 0.3333333333333333D};

         for(int var8 = 0; var8 < 3; ++var8) {
            if (var7[var8] < 0.0D) {
               ++var7[var8];
            }

            if (var7[var8] > 1.0D) {
               --var7[var8];
            }

            if (var7[var8] * 6.0D < 1.0D) {
               var7[var8] = var3 + (var1 - var3) * 6.0D * var7[var8];
            } else if (var7[var8] * 2.0D < 1.0D) {
               var7[var8] = var1;
            } else if (var7[var8] * 3.0D < 2.0D) {
               var7[var8] = var3 + (var1 - var3) * (0.6666666666666666D - var7[var8]) * 6.0D;
            } else {
               var7[var8] = var3;
            }
         }

         return Color.fromArgb((int)com.aspose.cells.b.a.zq.a(var7[0] * 255.0D, 0, 1), (int)com.aspose.cells.b.a.zq.a(var7[1] * 255.0D, 0, 1), (int)com.aspose.cells.b.a.zq.a(var7[2] * 255.0D, 0, 1));
      }
   }
}
